package com.jinyu.jyly.adapter;

import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jinyu.jyly.R;
import com.jinyu.jyly.bean.AddressList;


import java.util.List;


/**
 * 收货信息适配器
 */
public class ShipAddressListAdapter extends BaseQuickAdapter<AddressList, BaseViewHolder> {

    public ShipAddressListAdapter(int layoutResId, List<AddressList> data) {
        super(layoutResId,data);

    }

    @Override
    protected void convert(BaseViewHolder helper, AddressList item) {
        helper.addOnClickListener(R.id.tv_edit);
//        helper.addOnClickListener(R.id.tv_delete);

        helper.setText(R.id.tv_name,item.getName());
        helper.setText(R.id.tv_mobile,item.getPhone());
        helper.setText(R.id.tv_address,item.getPca());
        int is_default = item.getIs_default();
        //默认 0:否 1:是
        ImageView iv_is_default = helper.getView(R.id.iv_is_default);
        if(is_default == 0){ //非默认
            iv_is_default.setVisibility(View.GONE);
        }else{ //默认
            iv_is_default.setVisibility(View.VISIBLE);
        }
    }

}


